import java.io.*;

public class FileDemo{
  public static void main(String[] args){
    System.out.println("---------文件演示----------");
    try{
      System.out.println("---------文件写入演示----------");
      BufferedWriter file = new BufferedWriter(new FileWriter("runoob2.txt"));
      file.write("111");
      file.close();
      System.out.println("文件写入成功");

      System.out.println("---------文件读操作----------");
      BufferedReader in = new BufferedReader(new FileReader("runoob.txt"));
      String str;
      while ((str = in.readLine()) != null) {
        System.out.println(str);
      }


      System.out.println("---------文件夹删除----------");
      File fileDir = new File("./FileLab");
      fileDir.mkdirs();
      //fileDir.delete();
      System.out.println("文件夹个数："+ fileDir.list().length);
      String[] dirname = fileDir.list();
      for(String x : dirname){
        System.out.println("file Name" + x);
      }


    }catch(IOException e){

    }

  }
}